/*
 * Simple test for operon C++
 * compilation: g++ entities.cpp test.cpp operon.cpp -L /usr/local/BerkeleyDB.4.6/lib -ldb_cxx 
 */

#include "operon.h"


using namespace std;

int main(int argc,char** argv)
{
//open Operon
Operon operon("/operon/new/bdb");
//get a Handle to the SnpIds database for the NCBI/Human-Genome build 36
SnpIdsDB db(&operon,Assembly::HSA_NCBI_BUILD_36);
//open the database
db.open();

//simple search rs25
std::vector<SnpIds> array= db.get("rs25");
for(std::vector<SnpIds>::size_type i=0;i< array.size();++i)
{
//display the key and the value
cout  << "\t" << array[i] << endl;
}

//get an iterator for all the SNP between rs25 and rs26 (include rs26 too)
SnpIdsDB::iterator_type* iter= db.listBetween("rs25","rs26",true);
//loop over the results
while(iter->hasNext())
	{
	//get the result
	SnpIdsDB::pair_type pair=iter->next();
	//display the key and the value
	cout << pair.first << "\t" << pair.second << endl;
	}
//delete the iterator
delete iter;
//close the database
db.close();
return 0;
}
